<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <script>
        //通过代理操作另一个数据
        let obj = { x: 100 };
        let obj2 = { y: 100 };

        Object.defineProperty(obj2, 'x', {
            get() {
                console.log('x的值被读取了');
                return obj.x;
            },

            set(value) {
                console.log('y的值被修改了');
                obj.x = value;
            }
        })
    </script>

</body>

</html>